import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'

export const useMenuStore = defineStore('menu', () => {
    const route = useRoute()

    const menuItems = ref([
        {
            icon: "📊",
            label: "仪表盘",
            path: "/dashboard",
            key: 'dashboard'
        },
        {
            icon: "📝",
            label: "任务管理",
            path: "/task",
            key: 'task',
            children: [
                {
                    icon: "⏰",
                    label: "定时任务",
                    path: "/task/schedule",
                    key: 'taskSchedule'
                },
                {
                    icon: "📋",
                    label: "任务日志",
                    path: "/task/log",
                    key: 'taskLog'
                }
            ]
        },
        {
            icon: "📅",
            label: "日程管理",
            path: "/schedule",
            key: 'schedule'
        }
    ])

    const activeMenu = computed(() => {
        return route.path
    })

    return {
        menuItems,
        activeMenu
    }
}) 